/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.univali.sindico.dao;

import br.univali.sindico.entity.Apartamento;
import br.univali.sindico.entity.DadosAcesso;
import java.util.List;
import org.hibernate.Transaction;
import org.hibernate.classic.Session;

/**
 *
 * @author Fernando
 */
public class DadosAcessoDAO extends GenericDAO<DadosAcesso> {
    public boolean logar(DadosAcesso da){
        Session session = sessionFactory.openSession();
        Transaction t = session.beginTransaction();        
        List<Apartamento> result = session.createQuery("from DadosAcesso da where da.email = '" + da.getEmail() + "' and da.senha = '" + da.getSenha() + "'").list();
        t.commit();
        session.close();
        return result.size() == 0 ? false : true;
    }
}
